const url = 'chrome-extension://' + chrome.runtime.id + '/popup/index.html';
chrome.action.onClicked.addListener(async () => {
  const [windowInfo] = await chrome.tabs.query({
    url,
  });
  if (windowInfo) {
    chrome.windows.update(windowInfo.windowId, { focused: true });
    return;
  }
  chrome.windows.create({
    url: 'chrome-extension://' + chrome.runtime.id + '/popup/index.html',
    type: 'popup',
    width: 680,
    height: 430,
  });
});
